home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / minix / libsrc~1.z / libsrc~1 / strcspn.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-12-28  |  468 b   |  26 lines

  1. #include "lib.h"
  2.  
  3. /*
  4.  * strcspn - find length of initial segment of s consisting entirely
  5.  * of characters not from reject
  6.  */
  7.  
  8. _SIZET
  9. strcspn(s, reject)
  10. _CONST char *s;
  11. _CONST char *reject;
  12. {
  13.     register _CONST char *scan;
  14.     register _CONST char *rscan;
  15.     register _SIZET count;
  16.  
  17.     count = 0;
  18.     for (scan = s; *scan != '\0'; scan++) {
  19.         for (rscan = reject; *rscan != '\0';)    /* ++ moved down. */
  20.             if (*scan == *rscan++)
  21.                 return(count);
  22.         count++;
  23.     }
  24.     return(count);
  25. }
  26.